<?php
	include 'ourDate.php';
	include 'databaseHelper.php';
	include 'userHelper.php';
	

	$general = explode(",", $_GET['gen']);
	$creators = explode(",", $_GET['crt']);
	$moderators = explode(",", $_GET['mod']);
	
	//echo '<pre>'.print_r($general, true).'</pre>'; echo '<pre>'.print_r($creators, true).'</pre>'; echo '<pre>'.print_r($moderators, true).'</pre>'; die();
	
	if( !empty($general) && !empty($creators) && !empty($moderators) )
	{
		$updateUsers = array(); $getUsers = array('1' => $general, '2' => $creators, '3' => $moderators);
		foreach($getUsers as $typeID => $type)
			foreach($type as $key => $userID)
				$updateUsers[mysql_real_escape_string($userID)] = $typeID;
				
		//echo '<pre>'.print_r($updateUsers, true).'</pre>'; die();
		
		userHelper::updateAllUsersType($updateUsers);
		
		$string = "Updated User Access";
	}
	else
		$string = "Error updating user access, please try again.";
		
	echo $string;
	
	
?>